package cn.cvs.controller;

import cn.cvs.entity.Fruit;
import cn.cvs.service.FruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class FruitController {

    @Autowired
    private FruitService fruitService;

    @GetMapping("/list")
    public String list(Model model){

        List<Fruit> list=fruitService.list();

        model.addAttribute("list",list);

        return "list";
    }
}
